const express = require('express')
const app = express()

app.use(express.json()) //能取到 req.body
app.use(require('cors')()) //解决跨域问题
app.set('secret', 'yibing')

require('./routes/admin/index')(app)
require('./routes/student/index')(app)
require('./plugins/db')(app)

app.use('/uploads', express.static(__dirname +'/uploads'))
app.use('/admin', express.static(__dirname +'/admin'))
app.use('/student', express.static(__dirname +'/student'))

app.listen(3000, ()=> {
  console.log('http://localhost:3000');
})